package com.authine.cloudpivot.ext.enums.order;

/**
 * @author zhanjh
 */
public enum OrderApproveStatusEnum {
    /**
     * label标识审批状态
     */
    APPROVING(0,"审批中"),
    APPROVED(1,"已审批"),
    APPROVAL_REJECTION(2,"审批驳回"),
    REFUND_APPLICATION(3,"退款申请中"),
    RETURNING(4,"退货中"),
    TO_RETURN(5,"待退货"),
    RETIRED(6,"已退货"),
    REFUNDING(7,"退款中");

    public Integer id;
    public String text;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    OrderApproveStatusEnum(Integer id, String text) {

        this.id = id;
        this.text = text;
    }

    public static OrderApproveStatusEnum get(Integer code) {

        for (OrderApproveStatusEnum c : OrderApproveStatusEnum.values()) {
            if (c.id.toString().equals(code.toString())) {
                return c;
            }
        }
        return null;
    }

    public static OrderApproveStatusEnum get(String name) {

        for (OrderApproveStatusEnum c : OrderApproveStatusEnum.values()) {
            if (c.name().equals(name)) {
                return c;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return text;
    }


}
